from django.db import models


# Create your models here.
class ApiKeys(models.Model):
    """
    apikeys
    """
    id = models.BigAutoField(primary_key=True)
    platform = models.CharField(verbose_name="平台名称", max_length=32, blank=False, null=False)
    name = models.CharField(verbose_name="key名称", max_length=32, blank=False, null=False)
    type = models.CharField(verbose_name="用途", max_length=32, blank=False, null=False)    # 用途 chat => 聊天，img => 绘图
    value = models.CharField(verbose_name="apikey", max_length=256, blank=False, null=False)
    api_url = models.CharField(verbose_name="key的api地址", max_length=128, blank=False, null=False)
    enabled = models.BooleanField(verbose_name="当前状态", default=True)
    proxy_url = models.CharField(verbose_name="代理地址", max_length=128, null=True, blank=True, default=None)
    last_used_at = models.DateTimeField(verbose_name="最后使用时间", null=True, blank=True, default=None)

    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

